
const routes = [
  {
    path: '/login',
    component: () => import('layouts/login.vue')
  },
  {
    path: '/error',
    component: () => import('pages/Error404.vue')
  },
  {
    path: '/',
    component: () => import('layouts/MyLayout.vue'),
    children: [
      { name: '', title: 'CANGO CMDB', path: '', component: () => import('pages/Index.vue'), meta: { requireAuth: true, title: 'Cango CMDB' } },
      { name: 'listhost', path: 'listhost', component: () => import('pages/host/ListHost.vue'), meta: { requireAuth: true, title: '主机管理', menuId: 1 } },
      { name: 'newhost', path: 'newhost', component: () => import('pages/host/NewHost.vue'), meta: { requireAuth: true, title: '新增主机', menuId: 1 } },
      { name: 'edithost', path: '/edithost/:hostId', component: () => import('pages/host/EditHost.vue'), meta: { requireAuth: true, title: '编辑主机', menuId: 1 } },
      { name: 'listips', path: 'listips', component: () => import('pages/ips/ListIps.vue'), meta: { requireAuth: true, title: '网络资源管理', menuId: 2 } },
      { name: 'newips', path: 'newips', component: () => import('pages/ips/NewIps.vue'), meta: { requireAuth: true, title: '新增网络资源', menuId: 2 } },
      { name: 'editips', path: '/editips/:ipsId', component: () => import('pages/ips/EditIps.vue'), meta: { requireAuth: true, title: '编辑网络资源', menuId: 2 } },
      { name: 'minions', path: 'minions', component: () => import('pages/salt/Minions.vue'), meta: { requireAuth: true, title: 'Salt控制台', menuId: 3 } },
      { name: 'listsalt', path: 'listsalt', component: () => import('pages/salt/ListSalt.vue'), meta: { requireAuth: true, title: 'Salt临时表', menuId: 4 } },
      { name: 'listreturns', path: 'listreturns', component: () => import('pages/salt/ListReturns.vue'), meta: { requireAuth: true, title: 'Salt任务表', menuId: 5 } },
      { name: 'listservice', path: 'listservice', component: () => import('pages/service/ListService.vue'), meta: { requireAuth: true, title: '服务管理', menuId: 6 } },
      { name: 'newservice', path: 'newservice', component: () => import('pages/service/NewService.vue'), meta: { requireAuth: true, title: '新增服务', menuId: 6 } },
      { name: 'editservice', path: '/editservice/:serviceId', component: () => import('pages/service/EditService.vue'), meta: { requireAuth: true, title: '编辑服务', menuId: 6 } },
      { name: 'listproject', path: 'listproject', component: () => import('pages/project/ListProject.vue'), meta: { requireAuth: true, title: '项目管理', menuId: 7 } },
      { name: 'newproject', path: 'newproject', component: () => import('pages/project/NewProject.vue'), meta: { requireAuth: true, title: '新增项目', menuId: 7 } },
      { name: 'editproject', path: '/editproject/:projectId', component: () => import('pages/project/EditProject.vue'), meta: { requireAuth: true, title: '编辑项目', menuId: 7 } },
      { name: 'copyproject', path: '/copyproject/:projectId', component: () => import('pages/project/CopyProject.vue'), meta: { requireAuth: true, title: '复制项目', menuId: 7 } },
      { name: 'listpubproject', path: 'listpubproject', component: () => import('pages/publish/ListPubProject.vue'), meta: { requireAuth: true, title: '项目发布', menuId: 8 } },
      { name: 'listbuild', path: 'listbuild/:projectId', component: () => import('pages/publish/ListBuild.vue'), meta: { requireAuth: true, title: '项目构建', menuId: 8 } },
      { name: 'listpublish', path: 'listpublish/:projectId', component: () => import('pages/publish/ListPublish.vue'), meta: { requireAuth: true, title: '私有云发布', menuId: 8 } },
      { name: 'todaypublish', path: 'todaypublish', component: () => import('pages/mutipub/pubCenter.vue'), meta: { requireAuth: true, title: '今日发布', menuId: 9 } },
      { name: 'department_report', path: 'department_report', component: () => import('pages/report/DepartmentReport.vue'), meta: { requireAuth: true, title: '部门资源报表', menuId: 11 } },
      { name: 'project_report', path: 'project_report', component: () => import('pages/report/ProjectReport.vue'), meta: { requireAuth: true, title: '项目资源报表', menuId: 10 } },
      { name: 'publish_report', path: 'publish_report', component: () => import('pages/report/PublishReport.vue'), meta: { requireAuth: true, title: '发布资源报表', menuId: 12 } },
      { name: 'muti_build', path: 'mutiBuild', component: () => import('pages/publish/mutiBuild.vue'), meta: { requireAuth: true, title: '批量打包', menuId: 13 } },
      { name: 'test', title: 'CANGO CMDB', path: 'test', component: () => import('pages/test.js'), meta: { requireAuth: false, title: 'Cango CMDB' } }
    ]
  }
]

// Always leave this as last one
if (process.env.MODE !== 'ssr') {
  routes.push({
    path: '*',
    component: () => import('pages/Error404.vue')
  })
}

export default routes
